import * as vscode from "vscode";

/**
 * LeetCode Ultimate 的配置列表
 */
export enum ConfigurationEnum {
    workPath = "work.path",
    languages = "languages"
}

/**
 * VS Code 差距的配置工具类
 */
class ConfigurationUtil {

    private _config = () => vscode.workspace.getConfiguration("leetcode");

    get<T = string>(name: ConfigurationEnum): T | undefined {
        return this._config().get(name);
    }

    update<T = any>(name: ConfigurationEnum, value: T, global: boolean = true): Thenable<void> {
        return this._config().update(name, value, global);
    }
}

export const configurationUtil = new ConfigurationUtil();